﻿@model IEnumerable<ShareIt_MVC3.Models.Lending>

@{
    ViewBag.Title = "Index";
    var colorCheck = true;
}
<div class="post">
<h1>Leihvorgänge</h1>

<table>
   <tr>
        <th>Titel</th>
        <th>Autor</th>
        <th>Entleiher</th>
        <th>Verleiher</th>
        <th>
            Ausleihdatum
        </th>
        <th>
            Rückgabedatum
        </th>
    </tr>

@foreach (var item in Model) {
   <tr @((colorCheck == true) ? "class=colored-row" : "")>
        <td>@item.Resource.Title</td>
        <td>@item.Resource.Author</td>
        <td>@item.Lender.Username</td>
        <td>@item.Resource.Owner.Username</td>
        <td>
            @item.DateOfLending
        </td>
        <td>
            @item.DateOfReturning
        </td>
    </tr>
    
    if (colorCheck == false)
    {
        colorCheck = true;
    }
    else
    {
        colorCheck = false;
    }
}

</table>

</div>